package org.zcl.单例;

import java.io.Serializable;

/**
 * @PROJECT_NAME:
 * @DESCRIPTION: 饿汉，每次都new新对象返回【提前实例化好了一个实例，避免了线程不安全问题】
 * @USER: ZhuChengLin
 * @DATE: 2021/11/22 10:13
 */
public class HungrySingleton implements Serializable {

    private static HungrySingleton hungry = new HungrySingleton();

    private HungrySingleton() {

    }

    public static HungrySingleton getInstance() {
        int arr[];
        return hungry;
    }

    // 我们添加的readResolve()方法
    private Object readResolve() {
        return hungry;
    }
}
